package mlz.c_printstream;

import org.junit.Test;

import java.io.*;

/*
    打印流 - PrintWriter (OutputStream out, boolean autoFlush, Charset charset)
            PrintWriter(Writer out, boolean autoFlush)
 */
public class PrintWriterDemo01 {
    @Test
    public void test01() throws FileNotFoundException, UnsupportedEncodingException {
        //PrintWriter pw = new PrintWriter(new FileOutputStream("print.txt"),true,);

        PrintWriter pw = new PrintWriter(
                new OutputStreamWriter(
                        new FileOutputStream("print.txt", true), "UTF-8"), true);

        //使用write方法进行输入
        pw.write("你好");
        //打印 -> print  /  println
        pw.print("?????");
        pw.println();
        pw.print('c');
        pw.print(true);
        pw.println(3.14);



       /* //手动刷新缓冲区
        pw.flush();*/
    }
}















